# 安装必要的依赖
apt-get update
apt-get install wget curl apt-transport-https gnupg -y

# 安装 Elasticsearch
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list
apt-get update && apt-get install elasticsearch -y
service elasticsearch start
systemctl status elasticsearch

# 安装 MinIO
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
mv minio /usr/bin/minio
mkdir /opt/minio-data
export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=ezdata123
nohup minio server /opt/minio-data --console-address :19001 > /opt/minio-data/minio.log 2>&1 &

# 安装 MySQL
wget https://dev.mysql.com/get/mysql-apt-config_0.8.16-1_all.deb
dpkg -i mysql-apt-config_0.8.16-1_all.deb
apt-get update
apt-get install mysql-server -y
# 进入 MySQL shell 修改 root 密码
mysql -u root -p <<EOF
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'ezdata123';
FLUSH PRIVILEGES;
EOF

# 安装 Redis
apt-get install redis-server -y
echo -e "\nrequirepass ezdata123" | sudo tee -a /etc/redis/redis.conf
systemctl restart redis-server
systemctl status redis-server

# 安装 Nginx
apt-get install nginx -y
# systemctl status nginx